import cv2
import matplotlib.pyplot as plt
import numpy as np
img=cv2.imread('CV-Pictures/gate.jpg')

histb,_=np.histogram(img[0].ravel(),256,[0,255])
histg,_=np.histogram(img[1].ravel(),256,[0,255])
histr,_=np.histogram(img[2].ravel(),256,[0,255])
plt.plot(histb,'b')
plt.plot(histg,'g')
plt.plot(histr,'r')
plt.show()
cv2.imshow('img',img)
cv2.waitKey()
cv2.destroyAllWindows()